{*<!--

+---------------------------------------------------------------------------+
| Revive Adserver                                                           |
| http://www.revive-adserver.com                                            |
|                                                                           |
| Copyright: See the COPYRIGHT.txt file.                                    |
| License: GPLv2 or later, see the LICENSE.txt file.                        |
+---------------------------------------------------------------------------+
  
-->*}
<script src="assets/tinymce/tinymce.min.js"></script>
{if !$bannerId}
<form action='banner-edit.php' method='POST'>
    <input type='hidden' name='clientid' value='{$clientId}'>
    <input type='hidden' name='campaignid' value='{$campaignId}'>
    <input type='hidden' name='bannerid' value='{$bannerId}'>

    <table border='0' width='100%' cellpadding='0' cellspacing='0'>
        <tr><td height='25' colspan='3'><b>{t str=ChooseBanner}</b></td></tr>
        <tr><td height='25'>
        <select name='type' onChange='this.form.action=this.form.action+"?clientid={$clientId}&campaignid={$campaignId}";this.form.submit();' {tabindex} >
            {html_options options=$bannerTypes selected=$bannerType}
        </select>
        </td></tr>
    </table>
</form>
{phpAds_ShowBreak}

{else}
    {* Only display the notices when *changing* a banner size, not for new banners *}
<div class='errormessage' id='warning_change_zone_type' style='display:none'> <img class='errormessage' src='{$assetPath}/images/errormessage.gif' align='absmiddle' />
<span class='tab-r'>{t str=Warning}:</span><br />
{t str=WarnChangeZoneType}
</div>

<div class='errormessage' id='warning_change_banner_size' style='display:none'> <img class='errormessage' src='{$assetPath}/images/warning.gif' align='absmiddle' />
<span class='tab-s'> {t str=Notice}</span><br />
{t str=WarnChangeBannerSize}
</div>
{/if}

{if $disabled}
<div class='errormessage' id='warning_banner_readonly'> <img class='errormessage' src='{$assetPath}/images/warning.gif' align='absmiddle' />
<span class='tab-s'> {t str=Notice}</span><br />
{t str=WarnBannerReadonly}
</div>
{/if}

{*banner form*}
{*YZZZ*}
{include file=form/form.html form=$form}
{*YYZZZ*}
{*/banner form*}


<script language='JavaScript'>
<!--

{if $bannerId}
    document.bannerHeight ={$bannerHeight};
    document.bannerWidth ={$bannerWidth};
{/if}

{literal}
    function selectFile(o, handleSWF)
    {
        var filename = o.value.toLowerCase();
        var bannerForm = findObj ('bannerForm');
        $(o).siblings('input[value=t]').attr('checked', true);

        if (handleSWF) {
            // Show SWF Layer
            var swflayer = findObj ('swflayer');
            var swfAlternate1 = findObj ('swfAlternative1');
            var swfAlternate2 = findObj ('swfAlternative2');
            var iab_rmedia_note = findObj ('iab_rmedia_note');

            if (swflayer) {
                if (filename.indexOf('swf') + 3 == filename.length) {
                    swflayer.style.display = '';
                    swfAlternate1.style.display = '';
                    swfAlternate2.style.display = '';
                    iab_rmedia_note.style.display = ''; 
                } else {
                    swflayer.style.display = 'none';
                    swfAlternate1.style.display = 'none';
                    swfAlternate2.style.display = 'none';
                    iab_rmedia_note.style.display = 'none';
                }
            }
        }

    }

    function oa_sizeChangeUpdateMessage(id)
    {
        if (document.bannerWidth != document.bannerForm.width.value ||
            document.bannerHeight !=  document.bannerForm.height.value) {
                oa_show(id);

        } else if (document.bannerWidth == document.bannerForm.width.value &&
                   document.bannerHeight ==  document.bannerForm.height.value) {
            oa_hide(id);
        }
    }

    function oa_show(id)
    {
        var obj = findObj(id);
        if (obj) { obj.style.display = 'block'; }
    }

    function oa_hide(id)
    {
        var obj = findObj(id);
        if (obj) { obj.style.display = 'none'; }
    }

    function rv_tinymce(sel, enable, imgurl)
    {
        var r = function (str) {
            return new RegExp(str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), 'g');
        };

        if (enable) {
            if (imgurl) {
                jQuery(sel).val(jQuery(sel).val().replace(r('{img_url_prefix}'), imgurl));
            }

            tinymce.init({
                selector: sel,
                branding: false,
                plugins: 'code colorpicker contextmenu directionality image imagetools link lists media preview searchreplace table textcolor',
                toolbar_items_size : 'small',
                toolbar: 'undo redo | styleselect | bold italic | link image | forecolor backcolor | code',
                menubar: false,
                extended_valid_elements:'script[language|type|src]',
                forced_root_block: false,
                images_upload_url: '{/literal}banner-async-upload.php?clientid={$clientId}&campaignid={$campaignId}&bannerid={$bannerId}{literal}',
                images_upload_base_path: imgurl,
                images_upload_credentials: true,
                relative_urls : false,
                remove_script_host: false,
                allow_unsafe_link_target: true,
                content_style: "body { margin: 0; padding: 0 }"
            });
        } else {
            tinymce.remove(sel);

            if (imgurl) {
                jQuery(sel).val(jQuery(sel).val().replace(r(imgurl), '{img_url_prefix}'));
            }
        }
    }

    {/literal}
//-->
</script>



